package view.dialog.asbtract;

import javax.swing.JDialog;
import javax.swing.JFrame;

public abstract class AbstractDialog<T>  extends JDialog{

	/**
	 *
	 */
	private static final long serialVersionUID = 2257340061164071417L;

	protected JFrame parent;

	/**
	 *
	 * @param parent
	 * @param modal
	 */
	protected AbstractDialog(JFrame parent, boolean modal) {
		super(parent, modal);
	}

	/**
	 * Init view component
	 */
	protected abstract void initView();

	/**
	 * Display data to view
	 * @param t
	 */
	public abstract void initData(T t);

	/**
	 * show dialog
	 */
	public void showDialog(){
		this.setLocationRelativeTo(this.parent);
		this.setVisible(true);
	}

	/**
	 * hide dialog
	 */
	public void hideDialog(){
		this.setVisible(false);
	}
}
